using System;
using System.Text;
using FrameIdentityReq.Network;

namespace FrameIdentityReq.Network
{
    public static class AsyncSocketExtention
    {
        public static string StringMessage(this SocketState state)
        {
            return Encoding.ASCII.GetString(state.Buffer, 0, state.Buffer.Length);
        }

        public static byte[] ToBytes(this String str)
        {
            byte[] buffer = new byte[Encoding.ASCII.GetByteCount(str)];
            Encoding.ASCII.GetBytes(str, 0, str.Length, buffer, 0);
            return buffer;
        }
    }
}